// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Tournament.cs" company="Roman '4ux-nbIx' Novitsky">
//   Copyright (c) Roman '4ux-nbIx' Novitsky 2010
// </copyright>
// <summary>
//   Defines the Tournament type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace MtgMC.DataModel
{
  #region Namespace Imports

  using System;
  using System.Globalization;

  #endregion


  /// <summary>
  /// Describes and manipulates the tournament.
  /// </summary>
  public class Tournament : GameEvent
  {
    #region Constructors and Destructors

    /// <summary>
    /// Initializes a new instance of the <see cref="Tournament"/> class.
    /// </summary>
    public Tournament()
    {
      StartDate = DateTime.Now;
      EndDate = DateTime.MaxValue;
      Opponents = new TournamentOpponentInfoCollection();
    }

    #endregion


    #region Properties

    /// <summary>
    /// Gets the display name.
    /// </summary>
    /// <value>
    /// The display name.
    /// </value>
    public override string DisplayName
    {
      get
      {
        return string.Format(CultureInfo.CurrentCulture, "{0} [{1:d}-{2:d}]", Name, StartDate, EndDate);
      }
    }


    /// <summary>
    /// Gets or sets the end date.
    /// </summary>
    /// <value>
    /// The end date.
    /// </value>
    public DateTime EndDate
    {
      get;
      set;
    }


    /// <summary>
    /// Gets the name of the sealed deck.
    /// </summary>
    /// <value>
    /// The name of the sealed deck.
    /// </value>
    public string LimitedDeckName
    {
      get
      {
        return GetLimitedDeckName(Name);
      }
    }

    /// <summary>
    /// Gets the list of opponents.
    /// </summary>
    /// <value>
    /// The list of opponents.
    /// </value>
    public TournamentOpponentInfoCollection Opponents
    {
      get;
      private set;
    }

    /// <summary>
    /// Gets or sets the start date.
    /// </summary>
    /// <value>
    /// The start date.
    /// </value>
    public DateTime StartDate
    {
      get;
      set;
    }

    #endregion


    #region Public Methods

    /// <summary>
    /// Gets the name of the limited deck.
    /// </summary>
    /// <param name="tournamentName">
    /// Name of the tournament.
    /// </param>
    /// <returns>
    /// An instance of <see cref="System.String"/>.
    /// </returns>
    public static string GetLimitedDeckName(string tournamentName)
    {
      return tournamentName + " Deck";
    }

    #endregion
  }
}